Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 


Main difference between ToString("D2") and ToString("00") or add prefix zero?
Question Posted on 22 Sep 2022

Home >> DotNet >> C# >> Main difference between ToString("D2") and ToString("00") or add prefix zero?




Main difference between ToString("D2") and ToString("00") or add prefix zero?
To understand this we wil take a example of .ToString() method to convert value to string. Below is the example to do that

double d = 3.55123d;
int i = 4;
int j = 5;
Console.Write(i.ToString("D2"));
Console.Write(d.ToString("00"));
Console.Write(j.ToString("D2"));


Here in above code example first line will return "04" and second will also the same value "04" but third will return "05". So the difference in "00" and "D2" is "00" will handle the decimal and roundoff the result.
0
0



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
Simplest definition of partial classes and its rules?
Definition of Tuple class with some examples?
Define Race Condition in cSharp?
C#.Net Reserve Words
can we inherit private class level variables in c#






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |